import QtQuick 2.0
import 'FolderView' as FolderView


Rectangle {
    id: panel
    Component.onCompleted: panel.state = 'iconState'
    signal preview(string source)


    FolderView.TypeModel {
        id: typeModel
    }

    PanelTopper {
        id: panelTopper
        anchors.top: parent.top
        anchors.left: parent.left
        anchors.right: parent.right

        Row {
            spacing: 1
            Repeater {
                model: typeModel
                Button_one {
                    text: caption
                    height: panelTopper.height
                    width: 50
                    color: "#7667d7"
                    onClicked: {
                        folderView.source = qml;
                        console.log("Connection clicked signal" + index)
                    }

                }
            }
        }



    }

    FolderView.View {
        id: folderView

        anchors.left: parent.left
        anchors.right: parent.right
        anchors.top: panelTopper.bottom
        anchors.bottom: panelFooter.top

        source: typeModel.count <= 0? '' : typeModel.get(0).qml //'Views/DetailedList.qml'
        model:  FolderView.Model {}
        Component.onCompleted: {
            console.log(model, model.count)
        }

        onPreview: panel.preview(source)

    }

    PanelFooter {
        id: panelFooter
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.bottom: parent.bottom

    }

    /*states: [
        State {
            name: "iconState"
            PropertyChanges {
                target: grid
                visible: true

            }
        },

        State {
            name: "detailsState"
            PropertyChanges {
                target: list
                visible: true
            }
        }
    ]*/


    /*FileGrid {
        id: grid
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.top: panelTopper.bottom
        anchors.bottom: panelFooter.top
        visible: false
    }

    FileList {
        id: list
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.top: panelTopper.bottom
        anchors.bottom: panelFooter.top
        visible: false
    }*/
}
